home *** CD-ROM | disk | FTP | other *** search
/ PC for Alla 2005 May / PC för Alla 0505.iso / fullversioner / realsoft3d / data1.cab / Scripting / scripting / Intro / browse.js next >
Encoding:
Text File  |  2005-04-04  |  1.6 KB  |  60 lines

  1.  
  2. // JavaScript sample demonstrating r3Browsegadget (file control)
  3. // Copyrights 2004, Realsoft Graphics Oy
  4.  
  5. // --- include java script classes --- 
  6.  
  7. include("oops/r3window.js");
  8. include("oops/r3packer.js");
  9. include("oops/r3text.js");
  10. include("real/gadget/r3browgd.js");
  11.  
  12. {
  13.     
  14. function myFileHook(obj, event, value)
  15. {
  16.     obj.info.SetText("You selected file " + value);    
  17. }
  18.  
  19. // --- create  a new window, as usual --- 
  20.  
  21. window = new r3Window(R3WGA_Parent, _r3gui,
  22.                       R3WGA_Left, 200,
  23.                       R3WGA_Top, 100,
  24.                   R3WA_Title, "Callback Sample",
  25.                       R3WA_ReportCloseWindow, TRUE,
  26.                       R3WA_ReportNewSize, TRUE);
  27.  
  28. info = new r3Text(R3WGA_Parent, window,
  29.                   R3GA_Text, "Info",
  30.                   R3GTA_Text, "Welcome to JavaScript",  // current value
  31.                   R3GTA_Border, TRUE);
  32.  
  33. browse = new r3Browsegadget(R3WGA_Parent, window,
  34.                      R3BRGA_BrowsePrompt, "Save file",
  35.                      R3BRGA_NoUserInterface, FALSE,
  36.                          R3FLA_Action, R3FLACTION_GETSAVEFILENAME,
  37.                          R3GA_Text, "File",
  38.                          R3GA_ToolTip, "Select a file",
  39.                  R3RA_Hook, myFileHook);
  40.  
  41. browse.info = info; 
  42.  
  43.  
  44.  
  45. // --- Design layout for the GUI  ---- 
  46.  
  47. packer = new r3Packer(R3PA_Orientation, R3PAOF_VERTICAL);
  48.  
  49. packer.ADD(R3PAPF_FILLX, R3PAAF_ALIGN, browse);
  50. packer.ADD(R3PAPF_FILLX, R3PAAF_ALIGN, info);
  51.  
  52. window.SetGmanager(packer);
  53.  
  54. // --- compute native size, show ---
  55.  
  56. window.FIT(R3WFP_BESTFIT);
  57. window.REALIZE();
  58. }
  59.  
  60.